home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1996 June / macformat-038.iso / Demos / Interactive Wave / _DATAS / SHARED.Dxr / 00984_Gestion des RollOvers II.ls < prev    next >
Encoding:
Text File  |  1995-08-06  |  6.0 KB  |  196 lines

  1. on SetDcRollAuto
  2.   global listRollAuto
  3.   if (listRollAuto = list()) or voidp(listRollAuto) then
  4.     set listRollAuto to list()
  5.     exit
  6.   end if
  7.   FalsePisteTest(getAt(listRollAuto, 1))
  8.   set listRollAuto to list()
  9. end
  10.  
  11. on InitRollAuto SprRollAuto, Champs, operande
  12.   global listRollAuto
  13.   if (paramCount() <> 3) or (listRollAuto = list()) then
  14.     set listRollAuto to list(0, 0)
  15.   end if
  16.   setAt(listRollAuto, 1, SprRollAuto)
  17.   set Pz to 1
  18.   repeat with AccuA = 1 to the number of words in Champs / 3
  19.     set NumSpr to value(word Pz of Champs)
  20.     add(listRollAuto, the left of sprite NumSpr)
  21.     add(listRollAuto, the right of sprite NumSpr)
  22.     add(listRollAuto, the top of sprite NumSpr)
  23.     add(listRollAuto, the bottom of sprite NumSpr)
  24.     add(listRollAuto, the locH of sprite NumSpr)
  25.     add(listRollAuto, the locV of sprite NumSpr)
  26.     add(listRollAuto, the number of cast word Pz + 1 of Champs)
  27.     add(listRollAuto, the number of cast word Pz + 2 of Champs)
  28.     set Pz to Pz + 3
  29.   end repeat
  30.   setAt(listRollAuto, 2, (count(listRollAuto) - 2) / 8)
  31.   puppetSprite(SprRollAuto, 1)
  32.   BalayRollAuto()
  33. end
  34.  
  35. on AjouteRollAuto SprRollAuto, Champs
  36.   InitRollAuto(SprRollAuto, Champs, 1)
  37. end
  38.  
  39. on BalayRollAuto
  40.   global listRollAuto, DcCursMain, CastEfface
  41.   if listRollAuto = [] then
  42.     exit
  43.   end if
  44.   set AccuX to the mouseH
  45.   set AccuY to the mouseV
  46.   set SprRollAuto to getAt(listRollAuto, 1)
  47.   set Pz to 3
  48.   repeat with Compteur = 1 to getAt(listRollAuto, 2)
  49.     if getAt(listRollAuto, Pz) < AccuX then
  50.       if getAt(listRollAuto, Pz + 1) > AccuX then
  51.         if getAt(listRollAuto, Pz + 2) < AccuY then
  52.           if getAt(listRollAuto, Pz + 3) > AccuY then
  53.             set the castNum of sprite SprRollAuto to getAt(listRollAuto, Pz + 6)
  54.             set the locH of sprite SprRollAuto to getAt(listRollAuto, Pz + 4)
  55.             set the locV of sprite SprRollAuto to getAt(listRollAuto, Pz + 5)
  56.             SetAffTxtRoll(getAt(listRollAuto, Pz + 7))
  57.             set DcCursMain to 1
  58.             exit
  59.           end if
  60.         end if
  61.       end if
  62.     end if
  63.     set Pz to Pz + 8
  64.   end repeat
  65.   set the castNum of sprite SprRollAuto to CastEfface
  66.   set the locV of sprite SprRollAuto to 500
  67. end
  68.  
  69. on SetDcRollPict
  70.   global listRollPict
  71.   if (listRollPict = list()) or voidp(listRollPict) then
  72.     set listRollPict to list()
  73.     exit
  74.   end if
  75.   FalsePisteTest(getAt(listRollPict, 1))
  76.   FalsePisteTest(getAt(listRollPict, 2))
  77.   set listRollPict to list()
  78. end
  79.  
  80. on InitRollPict SpritePict, Champs, SpriteTitre, NameCastTitre, operande
  81.   global listRollPict
  82.   if (paramCount() <> 5) or (listRollPict = list()) then
  83.     set listRollPict to list(0, 0, 0, 0)
  84.   end if
  85.   setAt(listRollPict, 1, SpritePict)
  86.   setAt(listRollPict, 2, SpriteTitre)
  87.   setAt(listRollPict, 3, the number of cast NameCastTitre)
  88.   set Pz to 1
  89.   repeat with AccuA = 1 to the number of words in Champs / 3
  90.     set NumSpr to value(word Pz of Champs)
  91.     add(listRollPict, the left of sprite NumSpr)
  92.     add(listRollPict, the right of sprite NumSpr)
  93.     add(listRollPict, the top of sprite NumSpr)
  94.     add(listRollPict, the bottom of sprite NumSpr)
  95.     add(listRollPict, the locH of sprite NumSpr)
  96.     add(listRollPict, the locV of sprite NumSpr)
  97.     add(listRollPict, the number of cast word Pz + 1 of Champs)
  98.     add(listRollPict, the number of cast word Pz + 2 of Champs)
  99.     set Pz to Pz + 3
  100.   end repeat
  101.   setAt(listRollPict, 4, (count(listRollPict) - 4) / 8)
  102.   puppetSprite(SpritePict, 1)
  103.   puppetSprite(SpriteTitre, 1)
  104.   BalayRollPict()
  105. end
  106.  
  107. on AjouteRollPict SpritePict, Champs, SpriteTitre, NameCastTitre
  108.   InitRollPict(SpritePict, Champs, SpriteTitre, NameCastTitre, 1)
  109. end
  110.  
  111. on BalayRollPict
  112.   global listRollPict, DcCursMain, CastEfface
  113.   if listRollPict = [] then
  114.     exit
  115.   end if
  116.   set AccuX to the mouseH
  117.   set AccuY to the mouseV
  118.   set SpritePict to getAt(listRollPict, 1)
  119.   set Pz to 5
  120.   repeat with Compteur = 1 to getAt(listRollPict, 4)
  121.     if getAt(listRollPict, Pz) < AccuX then
  122.       if getAt(listRollPict, Pz + 1) > AccuX then
  123.         if getAt(listRollPict, Pz + 2) < AccuY then
  124.           if getAt(listRollPict, Pz + 3) > AccuY then
  125.             set the castNum of sprite SpritePict to getAt(listRollPict, Pz + 6)
  126.             set the locH of sprite SpritePict to getAt(listRollPict, Pz + 4)
  127.             set the locV of sprite SpritePict to getAt(listRollPict, Pz + 5)
  128.             set the castNum of sprite getAt(listRollPict, 2) to getAt(listRollPict, Pz + 7)
  129.             set DcCursMain to 1
  130.             exit
  131.           end if
  132.         end if
  133.       end if
  134.     end if
  135.     set Pz to Pz + 8
  136.   end repeat
  137.   set the castNum of sprite SpritePict to CastEfface
  138.   set the locV of sprite SpritePict to 500
  139.   set the castNum of sprite getAt(listRollPict, 2) to getAt(listRollPict, 3)
  140. end
  141.  
  142. on SetDcRollCast
  143.   global listRollCast
  144.   set listRollCast to list()
  145. end
  146.  
  147. on InitRollCast Champs, operande
  148.   global listRollCast
  149.   if (paramCount() <> 2) or (listRollCast = list()) then
  150.     set listRollCast to list(-1)
  151.   end if
  152.   add(listRollCast, word 1 of Champs)
  153.   set Pz to 2
  154.   repeat with AccuA = 1 to the number of words in Champs / 3
  155.     add(listRollCast, the number of cast word Pz of Champs)
  156.     add(listRollCast, value(word Pz + 1 of Champs))
  157.     add(listRollCast, word Pz + 2 of Champs)
  158.     set Pz to Pz + 3
  159.   end repeat
  160. end
  161.  
  162. on AjouteRollCast Champs
  163.   InitRollCast(Champs, 1)
  164. end
  165.  
  166. on BalayRollCast
  167.   global listRollCast, DcCursMain
  168.   if listRollCast = [] then
  169.     exit
  170.   end if
  171.   set CastRoll to the mouseCast
  172.   if CastRoll = -1 then
  173.     setAt(listRollCast, 1, -1)
  174.     if getAt(listRollCast, 2) <> "Nothing" then
  175.       do(getAt(listRollCast, 2))
  176.     end if
  177.     exit
  178.   end if
  179.   set NcCastRoll to getAt(listRollCast, 1)
  180.   setAt(listRollCast, 1, -2)
  181.   set PosRoll to getOne(listRollCast, CastRoll)
  182.   if PosRoll = 0 then
  183.     if getAt(listRollCast, 2) <> "Nothing" then
  184.       do(getAt(listRollCast, 2))
  185.     end if
  186.     exit
  187.   end if
  188.   setAt(listRollCast, 1, CastRoll)
  189.   if (CastRoll = NcCastRoll) and (getAt(listRollCast, PosRoll + 1) = 0) then
  190.     exit
  191.   end if
  192.   set NomMacro to getAt(listRollCast, PosRoll + 2)
  193.   do(NomMacro)
  194.   set DcCursMain to 1
  195. end
  196.